package jee.boot.module.sms;

import jee.boot.entity.sms.Sms;
import jee.boot.module.sms.queue.SmsProducer;
import jee.boot.module.sms.sender.DefaultSmsSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SendSmsHelper {
    @Autowired
    private SmsProducer producer;// 邮件队列(用于异步发送)
    @Autowired
    private DefaultSmsSender sender;//邮件发送接口(用于同步发送)

    /**
     * 同步发送邮件
     */
    public void sendSmsSync(Sms sms){
        sender.send(sms);
    }

    /**
     * 异步发送邮件
     */
    public void sendSmsAsyn(Sms sms){
        producer.send(sms);
    }

}
